/*
 *
 *  Copyright 2019-2022 felord.cn
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *       https://www.apache.org/licenses/LICENSE-2.0
 *  Website:
 *       https://felord.cn
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 */
package io.github.lhdxhl.wechatpay.v3;

import com.fasterxml.jackson.databind.node.ObjectNode;
import lombok.Getter;
import org.apache.http.client.methods.HttpUriRequest;
import org.springframework.http.*;
import org.springframework.util.MultiValueMap;

import java.lang.reflect.Type;
import java.net.URI;
import java.util.function.Consumer;

/**
 * @title WxRequestEntity
 * @description 请求类
 * @author lsk
 * @updateTime 2022/9/22 17:08
 * @throws
 */
@Getter
public class WxRequestEntity {

    /**
     * The request
     */
    private final HttpUriRequest request;
    /**
     * The Response body consumer.
     */
    private final Consumer<WxResponseEntity> responseBodyConsumer;


    /**
     * @title WxRequestEntity
     * @description 构造函数
     * @author lsk
     * @updateTime 2022/9/22 17:06
     * @throws
     */
    public WxRequestEntity(HttpUriRequest request, Consumer<WxResponseEntity> responseBodyConsumer) {
        this.request = request;
        this.responseBodyConsumer = responseBodyConsumer;
    }


    /**
     * @title of
     * @description 合并一个请求函数
     * @author lsk
     * @updateTime 2022/9/22 17:07
     * @throws
     */
    public static WxRequestEntity of(HttpUriRequest request, Consumer<WxResponseEntity> responseBodyConsumer) {
        return new WxRequestEntity(request, responseBodyConsumer);
    }
}
